package cobra0

import (
	"fmt"

	"github.com/spf13/cobra"
)

//定义子命令 version
var versionCmd = &cobra.Command{
	Use:   "version",
	Short: "version subcommand show git version info.",
	//version命令的方式
	Run: func(cmd *cobra.Command, args []string) {

		fmt.Println(cmd.Use,args,cmd.Short,Source)
		//output, err := ExecuteCommand("git", "version", args...)
		//if err != nil {
		//	Error(cmd, args, err)
		//}
		//
		//fmt.Fprint(os.Stdout, output)
	},
}

func init() {
	//设置本地选项
	versionCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from")
	rootCmd.AddCommand(versionCmd)
}
